package com.xiaodou.mjf.application.core.service.impl;

import javax.annotation.Resource;
import javax.transaction.Transactional;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Service;

import com.xiaodou.mjf.application.core.repository.SequenceRepository;
import com.xiaodou.mjf.application.core.service.SequenceService;
import com.xiaodou.mjf.entity.core.Sequence;
import com.xiaodou.mjf.infrastructure.common.app.JpaSimpleService;


/***
 *
 * Sequence业务访问实现
 * @author XiaoDou.com Code Generator
 * @version 1.0
 * 2014-10-29 17:37:52
 *
 */
@Service @Transactional
public class SequenceServiceImpl extends JpaSimpleService<Sequence,String> implements SequenceService{

	Logger logger = LoggerFactory.getLogger(SequenceServiceImpl.class);

    @Resource
    SequenceRepository sequenceRepository;

    @Override
    protected JpaRepository<Sequence, String> getRepository() {
        return sequenceRepository;
    }

    @Override
	public Sequence getInfoByType(Integer type) {
		
		return sequenceRepository.getInfoByType(type);
	}
    
    public String getMaxCodeNo(){
    	String result  = sequenceRepository.getMaxCodeNo();    
    	if (result == null)
    		result = "10001";
    	return result;
    }
}

